﻿using MediatR;
using RBAC.Domain;
using RBAC.Domain.Service.Interfae;
using RBACDuYaJun.Api.Appliction.Command.UserCommand;

namespace RBACDuYaJun.Api.Appliction.CommandHandlers.UserHanders
{
    public class UserUpdateCommandHandler : IRequestHandler<UserUpdateCommand, int>
    {
        private readonly IUserService _userService;
        public UserUpdateCommandHandler(IUserService userService)
        {
            _userService = userService;
        }

        public async Task<int> Handle(UserUpdateCommand request, CancellationToken cancellationToken)
        {
            return await _userService.UpdateUserInfo(new UserInfo()
            {
                userInfoId = request.userInfoId,
                userInfoName = request.userInfoName,
                password = request.password,
                userName = request.userName,
                userSex = request.userSex,
                provinceId = request.provinceId,
                cityId = request.cityId,
                countryId = request.countryId,
                userAddress = request.userAddress,
                departmentId = request.departmentId,
               addName="张三",
               addDate=DateTime.Now

            });

        }
    }
}
